//列表报表
mod list;
//图表报表
mod chart;
//交叉报表
mod cross;
use std::collections::HashMap;

use async_trait::async_trait;
pub use list::*;
pub use chart::*;
pub use cross::*;

use crate::error::Result;
use serde_json::Value;
use shq_common::prelude::{
    report::{DisplayCols, ReportDataResponse, ReportDefine},
    OrderItems, WhereCauses,
};
#[async_trait]
pub trait ReportTrait: Send + Sync {
    async fn get_rept_define(&self) -> Result<ReportDefine>;
    async fn get_options_map(&self) -> Result<HashMap<String, Vec<String>>>;
    async fn get_data_list(
        &self,
        where_causes: Option<WhereCauses>,
        orders: Option<OrderItems>,
        display_cols: DisplayCols,
        group_index: u8,
        drill_down_requ: Vec<(u8, Value)>,
        extra_where: Option<String>,
        page: u32,
        size: u16,
    ) -> Result<ReportDataResponse>;
    async fn export_xslx(
        &self,
        where_causes: Option<WhereCauses>,
        orders: Option<OrderItems>,
        display_cols: DisplayCols,
        group_index: u8,
        drill_downs: Vec<(u8, Value)>,
        extra_where: Option<String>,
        one_sheet_on_file: bool,
    ) -> Result<Vec<u8>>;
}
